package cn.com.gaobb.controller;

import cn.com.gaobb.dto.ResultDTO;
import cn.com.gaobb.service.TruckService;
import cn.com.gaobb.vo.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author haopt
 * @version 1.0
 * @ClassName TruckController
 * @Description TODO
 * @date 2021/4/2 10:35
 */
@RestController
@RequestMapping("/api/truck")
public class TruckController {
    @Autowired
    private TruckService TruckService;

    @PostMapping("/add")
    public ResultDTO<ResIdVO> add(@RequestBody ReqTruckAddVO reqVO) {
        return TruckService.add(reqVO);
    }

    @PostMapping("/update")
    public ResultDTO update(@RequestBody ReqTruckUpdateVO vo) {
        return TruckService.update(vo);
    }

    @PostMapping("/deleteList")
    public ResultDTO deleteList(@RequestBody ReqTruckDeleteListVO vo) {
        return TruckService.deleteList(vo);
    }

    @GetMapping("/detail")
    public ResultDTO<ResTruckDetailVO> detail(@RequestParam("id")String id) {
        return TruckService.detail(id);
    }

    @PostMapping("/listOfPage")
    public ResultDTO<ResPageVO<ResTruckDetailVO>> listOfPage(@RequestBody ReqPageVO vo) {
        return TruckService.listOfPage(vo);
    }
}
